package com.haizhi.crm.common.util;

import org.apache.commons.lang3.StringUtils;

/**
 * Created by yangyijun on 2018/5/30.
 */
public class PasswordInfo {
    String[] passwordSplits = null;
    String encryptPassword = null;

    PasswordInfo(String encryptPassword) {
        this.encryptPassword = encryptPassword;
        passwordSplits = StringUtils.splitPreserveAllTokens(encryptPassword, PasswordEncrypt.ENCRYPT_SEPERATOR);
    }

    String hashMethod() {
        return passwordSplits[0];
    }

    Integer hashIterations() {
        return Integer.parseInt(passwordSplits[1]);
    }

    String salt() {
        return passwordSplits[2];
    }

    String originPassword() {
        return passwordSplits[3];
    }

    public String toString() {
        return encryptPassword;
    }
}
